<?php
/**
 *
 *
 *
 */
namespace app\admin\model;
use  app\admin\model\User;

class NationalUserLottery extends DataBase
{
    public function getDataList($page_config)
    {
//        $data = $this ->order('id desc') ->paginate($page_config);
//        $send_data = [];
//        foreach ($data as $v){
//            $user = User::where(['id'=>$v['user_id']])->find();
//            $send_data[] = ['id'=> $v['id'],'nickname'=> $user['nickname'],  'num' => $v['num'], 'award_name' => $v['award_name']];
//        }
//        return $send_data;

        $send_data = $this->alias('a')
            ->join('users b','b.id = a.user_id','left')
            ->field('a.id,b.nickname,a.num,a.award_name')
            ->order('a.id desc')
            ->paginate($page_config);

        return $send_data;
    }
}